/**
 * 
 */
package me.dbest.javase.learn.thread;
/**
 * 
 */

import java.util.Random;

/**
 * @author nishant.awasthi
 *
 */
public class ThreadBasics {

	/**
	 * 
	 */
	public ThreadBasics() {
	
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		System.out.println(Thread.currentThread().getName());
		Thread th= new Thread(new ThreadImpl());
		th.setDaemon(true);
		th.start();
	}
	
	/**
	 * 
	 * @author nishant.awasthi
	 *
	 */
	public static class ThreadImpl implements Runnable {

		@Override
		public void run() {
			while(true){
				System.out.println("hi"+ new Random().nextInt());
				try {
					
					Thread.sleep(5000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
		
	}

}

